$(function() {

    var setting = {
        getList: function() {
            $.ajax({
                url: wsCommon.host + '/api/members/myInfo',
                dataType: wsCommon.jsonType,
                success: function(res) {
                    if(res.code == 1) {
                        if(!res.result) {
                            wsCommon.setCookie('go_back_link', window.location.href);
                            window.location.href = './passport-login.html';
                            return;
                        }
                        $('[data-role="username"]').append(res.data.username);
                        if(res.data.email) {
                            $('[data-role="email"]').removeClass('hide').append(res.data.email);
                        }
                        if(res.data.mobile) {
                            $('[data-role="mobile"]').removeClass('hide').append(res.data.mobile);
                        }

                    } else {
                        iosOverlay({
                            text: res.reason,
                            duration: 1000
                        });
                    }
                },
                error: function(e) {
                }
            })
        },
        init: function() {
            this.getList();
        }
    }

    setting.init();
})
